package com.dhl.fin.api.controller;

import com.dhl.fin.api.common.controller.CommonController;
import com.dhl.fin.api.common.dto.ApiResponse;
import com.dhl.fin.api.domain.ConsultChat;
import com.dhl.fin.api.service.ConsultChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.AccessType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.MultipartRequest;

import javax.servlet.http.HttpServletResponse;

/**
 * @author CuiJianbo
 * @since 2025/3/19
 */
@Transactional(rollbackFor = Exception.class)
@RestController
@RequestMapping("consultchat")
public class ConsultChatController extends CommonController<ConsultChat> {

    @Autowired
    private ConsultChatService consultChatService;

    @RequestMapping("export/consult")
    public void exportConsultChat(HttpServletResponse response) throws Exception {
        consultChatService.exportConsult(response);
    }


    @ResponseBody
    @RequestMapping("import/consult")
    public ApiResponse importConsultChat(MultipartHttpServletRequest request) throws Exception {
        consultChatService.importConsult(request);
        return ApiResponse.success();
    }


}
